<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Expires" content="0">
		 <meta http-equiv="Pragma" content="no-cache">
		 <meta http-equiv="Cache-control" content="no-cache">
		 <meta http-equiv="Cache" content="no-cache">
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>异常现象及处理方法</title>
	
		<link rel="stylesheet" href="../layui/css/layui.css"/>
	</head>
	<body>
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>工程部机台维修信息收集</b></big></legend>
			<div class="layui-fluid layui-form layui-form-pane">
				<div class="layui-row layui-form-item">
					<label class="layui-form-label">扫描二维码:</label>
					<div class="layui-input-block">
						<input class="layui-input" placeholder="请扫入特定的二维码" id="qr" type="text"/>
					</div>
				</div>
				
			</div>
			
			
		</fieldset>
		
			<div class="layui-fluid layui-form layui-form-pane">
			<div class="layui-form-item">
				<label class="layui-form-label">工序</label>
				<div class="layui-input-block">
					<input id="radio0" type="radio" name="gongxu" value="固晶" title="固晶" lay-filter="gongxu">
					<input id="radio1" type="radio" name="gongxu" value="焊线" title="焊线" lay-filter="gongxu">
					<input id="radio2" type="radio" name="gongxu" value="点胶" title="点胶" lay-filter="gongxu">
					<input id="radio3" type="radio" name="gongxu" value="切割" title="切割" lay-filter="gongxu">
					<input id="radio4" type="radio" name="gongxu" value="分光" title="分光" lay-filter="gongxu">
					<input id="radio5" type="radio" name="gongxu" value="编带" title="编带" lay-filter="gongxu">
				</div>
		  </div>
		  </div>
		
		
		
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>当前信息</b></big></legend>
			<div id="DQ" class="layui-fluid layui-form layui-form-pane">
				<div class="layui-col-sm4">
						<label class="layui-form-label">作业员:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="这里是当前机台" id="work_name" type="text"/>
						</div>
				</div>
				<div class="layui-col-sm4">
					<label class="layui-form-label">维修员:</label>
					<div class="layui-input-block">
						<input class="layui-input" readonly=true placeholder="这里是员工姓名" id="YGXM" type="text"/>
					</div>
				</div>
				<div class="layui-row">
					
				</div>
				<div class="layui-col-sm4">
						<label class="layui-form-label">当前机台:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="这里是当前机台" id="DQJT" type="text"/>
						</div>
				</div>
				<div class="layui-col-sm4">
					<label class="layui-form-label">工单号:</label>
					<div class="layui-input-block">
						<input class="layui-input" readonly=true placeholder="工单号" id="order_id" type="text"/>
					</div>
				</div>
				
				<div class="layui-row">
					
				</div>
				<div class="layui-col-sm4">
					<label class="layui-form-label">开始时间:</label>
					<div class="layui-input-block">
						<input class="layui-input" readonly=true placeholder="开始时间" id="startime" type="text"/>
					</div>
				</div> 
				<div class="layui-col-sm4">
					<label class="layui-form-label">结束时间:</label>
					<div class="layui-input-block">
						<input class="layui-input" readonly=true placeholder="结束时间" id="endtime" type="text"/>
					</div>
				</div>
				<div class="layui-row">
					<div class="layui-col-sm4">
						<label class="layui-form-label">异常现象:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="异常现象" id="YCXX" type="text"/>
						</div>
					</div>
					<div class="layui-col-sm4">
						<label class="layui-form-label">处理方法:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="处理方法" id="CLFF" type="text"/>
						</div>
					</div>
				</div>
			</div>
		</fieldset>
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>选择处理方法</b></big></legend>
				<!-- <div class="layui-row"> -->
						<!-- <button disabled="disabled" class="layui-btn  layui-btn-radius layui-btn-normal layui-btn-disabled" id="KSSJ">开始时间</button> -->
				
				<!-- </div> -->
				
				<div class="layui-row">
					<div class="layui-form-item layui-form-text layui-col-sm8">
						<label class="layui-form-label ">备注</label>
						<div class="layui-input-block">
						  <textarea placeholder="如有其他处理方法请输入处理过程" class="layui-textarea" id="handle_process"></textarea>
						</div>
					</div>				
					
				</div>
				
				
				<hr  width="100%" style="height:1px;" color="#000000"/>
				
				<div class="layui-row">
					<div class="layui-form-item layui-form-text layui-col-sm8">
						<label class="layui-form-label ">处理方法</label>
						<div class="layui-input-block">
						  <textarea placeholder="可多选可自定义" class="layui-textarea" id="custom"></textarea>
						</div>
						<div>
							<button disabled="disabled" class="layui-btn  layui-btn-radius layui-btn-normal layui-btn-disabled" id="keepbutton">存储</button>
						</div>
					</div>				
					
				</div>
				<div  class="layui-btn-container" class="layui-row" id="button_box">
					
				</div>
			</div>
		</fieldset>
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>维修信息清单</b></big></legend>
			<div class="layui-fluid layui-form layui-form-pane">
				<div id="YC" class="layui-row"></div>
			</div>
		</fieldset>
		
		<fieldset class="layui-elem-field site-demo-button layui-btn-container">
			<legend><big><b>机台报异常列表</b></big></legend>
			<div class="layui-fluid layui-form layui-form-pane">
				<div id="YCLB" class="layui-row"></div>
			</div>
		</fieldset>
		<!-- 加载类ui文件 -->
		<script src="../layui/layui.js"></script>
		<!-- 加载jQuery文件 -->
		<script src="../js/jquery.min.js"></script>
		<script src="../jexcel-master/dist/js/jquery.jexcel.js"></script>
		<!-- 写脚本 -->
		<script>
		<!-- 程序更新后将之前单选的工序继续选上 -->
		for(var i=0;i<6;i++){
			
			if(localStorage.fixgongxu==$("#radio"+i).val()){
				var r=confirm('您所在工站是：'+localStorage.fixgongxu+'??');
				if(r==true){
					$("#radio"+i).prop("checked",true);
				}
				else{
				localStorage.fixgongxu="";
				}
			}
			
		}
			var buttonycid='';
			var gongxu='';
			var ycid=new Array();//fix表中的ycid集
			var fixlist=new Array();
			var ZiDian1 = {};//字典1
			var czycid="";
			//这里是画面准备完毕后执行的程式
			$(document).ready(function(){
				//$("#keepbutton").attr("disabled",true);
				$("#keepbutton").attr("disabled",false);//启用存储按钮
				$("#keepbutton").attr("class", 'layui-btn  layui-btn-radius layui-btn-normal');//存储按钮渲染为可用
		
				//载入layui模块
				//layer弹出层,form表单,element元素组件做分页或其他
				$("#qr").select();
				layui.use(['layer','form','element','table'], function(){
					var layer = layui.layer
						,form = layui.form
						,element = layui.element
						,table = layui.table
					;
					//如果HTML5WEB存储存在,就查询,否则就弹窗提示
					
					
					//监听获取工序
					form.on('radio(gongxu)', function(data){
					//console.log(data.elem); //得到radio原始DOM对象

						console.log(data.value); //被点击的radio的value值
						gongxu = data.value;
						localStorage.fixgongxu = gongxu;
						//$("#YCLB").html("");
						location.reload();//变更了工序后就刷新整个画面
					});
					//function refreshDiv1
					
					if (localStorage.fixyggh){//如果HTML5WEB存储存在,就查询,否则就弹窗提示
						//$("#YGXM").val(localStorage.fixyggh);
						$.ajax({
							type:'POST',
							url:"http://172.31.3.27:84/index.php?s=/scancode/shou_jian/xm",
							data:"qrc="+localStorage.fixyggh,
							dataType:"text",
							success:function(sss){
								$("#YGXM").val(sss);
								//layer.msg(sss + '，欢迎回来!');
								localStorage.ygxm = sss;
								$("#YGXM").val(localStorage.ygxm);
							}
						});
					}else{
						layer.msg("请先登录");
					}
					/*
					
					*/
					
					getycinfprmation();
				});
				//画面准备完毕后就选择扫码输入框
				$("#qr").select();
				
				//监听指定单选框
				
				
			});
			var YCID="";//异常ID
			var Str2 = "0";//取前面两个字符进行下面的判断
			var JT2 = {};//机台的字典: 存扫描的次数 i
			var DQYC = {};//存机台当前的异常, 如果异常不是当前异常就发出警告
			var i = 0;
			var button_number;
			var DQJT;//当前机台
			var name;//员工姓名
			var YiChangStartTime="";//开始时间
			var endtime;//结束时间
			var YCXX;//异常现象
			var YCCODE="";//异常编码
			var CLFF;//处理方法
			var YCT = {};
			var fix_code="";//处理代码
			var s3="";//取机台前三码
			//这里是扫描输入框的回车按下后执行的程式
			var FrontTwoString;
			$("#qr").keypress(function(e){
				//如果按下的键值是回车键13就执行以下语句
				if(e.keyCode === 13){
				console.log(gongxu);
					//扫描输入框选择
					$("#qr").select();
					//定义局部变量QRC=扫描输入框的值
					var QRC = $("#qr").val();
					FrontTwoString=(QRC.substring(0,2));//前两位
					if(FrontTwoString=="EM"){//判断是不是员工号
						localStorage.fixyggh=QRC;
						console.log(localStorage.fixyggh);
						$.ajax({
							type:'POST',
							url:"http://172.31.3.27:84/index.php?s=/scancode/shou_jian/xm",
							data:"qrc="+localStorage.fixyggh,
							dataType:"text",
							success:function(sss){
								$("#YGXM").val(sss);
								layer.msg(sss + '，欢迎回来!');
								localStorage.ygxm = sss;
								$("#YGXM").val(localStorage.ygxm);
							}
						});
						location.reload();
					}
					if(FrontTwoString!="EM"){//扫描的内容为异常代码
						$("#button_box").html("");
						YCCODE=QRC+';'+YCCODE;
						$.ajax({
							type:'POST',
							async: false,
							url: "http://172.31.3.27:84/index.php?s=/scancode/Fix/selecexceptmethod",//POST傳一個超長字串到後端
							data:"except_number="+QRC,
							dataType : "JSON",
							success:function(sss){
							//$("#YCXX").val(sss[0]["异常现象"]+';'+$("#YCXX").val());
							console.log(sss);
							for(var k in sss['getexcmethod'])
							{
								var ycxx=sss['getexcmethod'][k]["异常现象"];
								var gh = sss['getexcmethod'][k]['处理代码'];
								var jt = sss['getexcmethod'][k]['处理方法'];
								$("#button_box").prepend(
										"<div class='layui-col-sm2'>"+ 
											"<button id='"+'button'+k+"' value='"+'value'+k+"' class='layui-btn layui-btn-fluid layui-btn-radius '  onclick='showDetails(this) 'return on_del_click("+'value'+k+",this)' data-delid-qty='"+gh+"'>"+jt+
											"</button>"+	
										"</div>"
									);
							}
							$("#YCXX").val($("#YCXX").val()+ycxx+';');
							//$("#YCXX").val(ycxx+';'+$("#YCXX").val());
						}
						});
					
					}
					console.log($("#DQJT").val()+"-"+$("#order_id").val()+"-"+YCCODE+"-"+$("#YCXX").val());
					
					/*测试中先注解$("#DQJT").val()!=""&&$("#order_id").val()!=""&&&&$("#startime").val()==""
					if($("#DQJT").val()!=""&&$("#order_id").val()!=""&&YCCODE!=""&&$("#startime").val()!=""){//满足机台，工单号，异常现象不为空是开始按钮被取用
						$("#keepbutton").attr("disabled",false);//启用存储按钮
						$("#keepbutton").attr("class", 'layui-btn  layui-btn-radius layui-btn-normal');//存储按钮渲染为可用
								
						console.log(button_number);
						for(var i=0;i<button_number;i++){
							$("#button"+i).attr("disabled", false);//启用button_box组的按钮
							$("#button"+i).attr("class", 'layui-btn layui-btn-fluid layui-btn-radius');//渲染button_box组按钮为可用
						}
					}*/
					$("#qr").val("").select();
				}
				
				//$("")
			});
	
			$("#keepbutton").click(function(){//存储按钮监听
				$("#qr").select();
				$("#"+buttonycid).remove();//移除被选中的异常信息
				
				
				$.ajax({//结束时间
					type:'POST',
					url:"http://172.31.3.27:84/index.php?s=/scancode/Fix/gettime",
					dataType:"text",
					async: false,
					success:function(sss){
						$("#endtime").val(sss);
					}
				});
				
					msgstr = {
						 'msg':'机台号:' + $("#DQJT").val() + ' 已完成维修,请确认:' + 'OK'
						,'sss':{
							'JT':$("#DQJT").val()
							,'JG':'OK'
						}
					}
					var jsonstr1 = JSON.stringify(msgstr);
					$.ajax({
						type:"publish",
						url:"http://"+document.domain+":2121/?type=publish"+"&to="+s3+"&content="+jsonstr1,
						dataType:"text",
						success: function(data){
							layer.msg('发送成功');//返回信息);
							console.log(data);
						}
					});
				
					var k=$("#custom").val();
					$("#CLFF").val(k);
					console.log($("#YCXX").val()+"-"+YCCODE);
					if($("#custom").val()!=""){//自定义不能为空
						/*$("#KSSJ").attr("disabled", false);//开始时间按钮启用
						$("#KSSJ").attr("class", 'layui-btn  layui-btn-radius layui-btn-normal layui-btn-radius');//渲染为可用状态
						*/$("#keepbutton").attr("disabled",true);//存储按钮禁用
						$("#keepbutton").attr("class", 'layui-btn  layui-btn-radius layui-btn-normal layui-btn-disabled');//渲染
						for(var i=0;i<button_number;i++){
							$("#button"+i).attr("disabled", true);//button_box禁用
							$("#button"+i).attr("class", 'layui-btn layui-btn-fluid layui-btn-radius layui-btn-disabled');
						}
						console.log(YCID);
							$.ajax({
								type:"POST",
								url:"http://172.31.3.27:84/index.php?s=/scancode/Fix/fixkeep",
								//异常现象，处理方法（自定义栏），异常代码，处理代码，处理过程记录，异常ID
								data:"YCXX="+$("#YCXX").val()+"&method="+$("#custom").val()+"&except_number="+YCCODE+"&fix_code="+fix_code+"&handle_process="+$("#handle_process").val()+"&YCID="+YCID+"&YGXM="+$("#YGXM").val(),
								dataType:"text",
								success: function(data){
									layer.msg('保存成功');//返回信息);
									console.log(data);
								}
							});
						}
						else{
							layer.msg('自定义处理方法不能为空');
							//alert("处理过程和自定义处理方法不能为空");
						}
						var fix="<div  class='layui-col-xs6 layui-col-sm4 layui-col-md2 layui-anim-up'>"+
									"<fieldset  class='layui-elem-field layui-form layui-form-pane'>"+
										"<legend>机台号: " + $("#DQJT").val() + "</legend>"+
										"<div class='layui-field-box'>"+
											"<div>"+
												"<br/>操作员: "+ $("#YGXM").val() +
												"<br/>开始时间: "+ $("#startime").val() +
												"<br/>结束时间: " + $("#endtime").val() +
												"<br/>异常现象: "+ $("#YCXX").val() +
												"<br/>处理方法: " + k +
											"</div>"+
										"</div>"+
									"</fieldset>"+
								"</div>"
						if(fixlist.length>5){
							fixlist.shift();
							fixlist.push(fix);
							localStorage.fixlist=fixlist;
							console.log(fixlist);
						}
						else{
							fixlist.push(fix);
							localStorage.fixlist=fixlist;
							console.log(fixlist);
						}
						$("#YC").append(//显示到维修信息清单中
							"<div  class='layui-col-xs6 layui-col-sm4 layui-col-md2 layui-anim-up'>"+
								"<fieldset  class='layui-elem-field layui-form layui-form-pane'>"+
									"<legend>机台号: " + $("#DQJT").val() + "</legend>"+
									"<div class='layui-field-box'>"+
										"<div>"+
											"<br/>操作员: "+ $("#YGXM").val() +
											"<br/>开始时间: "+ $("#startime").val() +
											"<br/>结束时间: " + $("#endtime").val() +
											"<br/>异常现象: "+ $("#YCXX").val() +
											"<br/>处理方法: " + k +
										"</div>"+
									"</div>"+
								"</fieldset>"+
							"</div>"
						);
						
						
				
				$("#YCXX").val("");
				$("#custom").val("");
				$("#CLFF").val("");
				$("#startime").val("");
				$("order_id").val("");
				$("handle_process").val("");
				$("endtime").val("");
				/*$("#DQJT").val("");
				
				$("endtime").val("");*/
				//location.reload();
			});
			
			function showDetails(del_id)
			{//自动识别button组
								
				$("#qr").select();
				k=$(del_id).html();//获取button的按键值
				$("#custom").val(k+';'+$("#custom").val());
				$("#CLFF").val(k+';'+$("#CLFF").val());
				
				//$("#endtime").val(GetDateStr(0));//结束时间
				fix_code = del_id.getAttribute("data-delid-qty")+';'+fix_code;//按键对应的处理代码
				$("#del_id").hide();
				
				buttonid=del_id.getAttribute("id");
				console.log(fix_code+"-"+$("#CLFF").val());
				$("#"+buttonid).remove();
				console.log($("#DQJT").val()+"-"+$("#YGXM").val()+"-"+$("#startime").val()+"-"+$("#endtime").val()+"-"+$("#YCXX").val()+"-"+k+"-"+YCCODE+"-"+fix_code);
			
				/*$("#DQJT").val("");
				$("endtime").val("");*/
				//location.reload();
			}
			function showyc(del_id){
				$("#endtime").val("");
				$("#keepbutton").attr("disabled",false);//启用存储按钮
				$("#keepbutton").attr("class", 'layui-btn  layui-btn-radius layui-btn-normal');//存储按钮渲染为可用
//ZiDian1[d] = d +'丨机台：'+jt+'丨工单：'+gd+'丨报修原因：'+yc+ '丨时间：'+ycst+ '丨报修：'+gh+'丨处理：'+cl;
								
				var k=$(del_id).html();//获取button的按键值
				//开始时间
				
				
				buttonycid=del_id.getAttribute("id");
				information = k.split('丨');
				WOEKNAMEs=information[5].split('：');
				DQJTs=information[1].split('：');
				order_ids=information[2].split('：');
				
				$("#DQJT").val(DQJTs[1]);
				//s3 = $("#DQJT").val().substr(0,3);
				$("#order_id").val(order_ids[1]);
				var d1 =information[0];
				YCID=d1;
				//SJDM = d1;
				//del_id.disabled=true;//按钮禁用style='background-color: #7ED321;' 
				del_id.className='layui-col-sm7 layui-btn layui-btn-xs layui-btn-normal';//
				del_id.style='background-color: #7ED321;';
				console.log(localStorage.fixyggh+"--"+d1+"--"+localStorage.fixgongxu);
				layer.msg("数据更新中,请稍后!");
				$.ajax({
					url:"http://172.31.3.27:84/index.php?s=/scancode/Fix/shoujian",//172.31.3.27:84//172.31.3.27:84
					data:"qrc="+localStorage.fixyggh+"&idd="+d1+"&gxx="+localStorage.fixgongxu,
					dataType:"text",
					success:function(sss){
						if(sss){
								layer.msg(sss);
							}
					}
				});
				
				$.ajax({
					type:"POST",
					url:"http://172.31.3.27:84/index.php?s=/scancode/Fix/fixstartime",
					data:"DQJT="+$("#DQJT").val()+"&name="+$("#YGXM").val()+"&order_id="+$("#order_id").val()+"&YCID="+d1,
					dataType:"text",
					success: function(data){
						$("#startime").val(data);
						layer.msg('写入成功');//返回信息);
						
					}
				});
				getname(WOEKNAMEs[1]);
				
				
			}
	
			//循环查询
			function refreshDiv1()
			{
				$("#YCLB").html("");
				getycinfprmation();
				
			}
			//员工号获取姓名函数
			function getname(name){
				$.ajax({
					type:'POST',
					url:"http://172.31.3.27:84/index.php?s=/scancode/shou_jian/xm",
					data:"qrc="+name,
					dataType:"text",
					success:function(sss){
						$("#work_name").val(sss);
					}
				});
			}
			//获取已处理的
			//获取维修单的函数
			
			function getycinfprmation()
			{
			
				<!-- $.ajax({ -->
					<!-- type:'POST', -->
					<!-- url:"http://172.31.3.27:84/index.php?s=/tdled/Fix/WCL", -->
					
					<!-- dataType:"JSON", -->
					<!-- success:function(sss){ -->
						<!-- for(var k=0;k<sss['SJ'].length;k++) -->
						<!-- { -->
							<!-- var d = sss['SJ'][k]['YCID']; -->
							<!-- ycid[k]=d; -->
							<!-- //console.log(d); -->
						<!-- } -->
					<!-- } -->
				<!-- }); -->
			
				//layer.msg('刷新中');
				if(localStorage.fixgongxu){
				
					$.ajax({
						type:'POST',
						url:"http://172.31.3.27:84/index.php?s=/scancode/Fix",
						data:"gxx="+localStorage.fixgongxu,
						dataType:"JSON",
						success:function(sss){
							for(var k in sss['SJ'])
							{
								czycid='';
								var gh = sss['SJ'][k]['YGGH'];
								var jt = sss['SJ'][k]['YiChangJiTai'];
								var gd = sss['SJ'][k]['GongDanHao'];
								var cl = sss['SJ'][k]['ChuLiGH'];
								var d = sss['SJ'][k]['YCID'];
								var yc = sss['SJ'][k]['YiChang'];
								var ycst = sss['SJ'][k]['YiChangStartTime'];
								<!-- for(var i=0;i<ycid.length;i++){ -->
									<!-- if(d==ycid[i]){ -->
										<!-- czycid='t'; -->
										<!-- console.log(czycid); -->
									<!-- } -->
								<!-- } -->
								console.log($("#YGXM").val());
								ZiDian1[d] = d +'丨机台：'+jt+'丨工单：'+gd+'丨报修原因：'+yc+ '丨时间：'+ycst+ '丨报修：'+gh+'丨处理：'+cl;
									if(cl=='')
								 {
									html = "<button id='"+d+"' class='layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal' data-d='"+d+"' onclick='showyc(this)'>"+ZiDian1[d]+"</button>";
									$("#YCLB").append(html);
								}
								if (cl!=''&&cl==localStorage.fixyggh) {
									html = "<button id='"+d+"' style='background-color: #7ED321;' class='layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal' data-d='"+d+"' onclick='showyc(this)'>"+ZiDian1[d]+"</button>";
									$("#YCLB").append(html);
								}
								
								
								if (cl!=''&&cl!=localStorage.fixyggh) {
									html = "<button id='"+d+"' disabled='true' class='layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal layui-btn-disabled' data-d='"+d+"' onclick='showyc(this)'>"+ZiDian1[d]+"</button>";
									$("#YCLB").append(html);
								}
								
							}
						}
					});
				}
			}
			
			
			function GetDateStr(AddDayCount) {//获取时间
				var dd = new Date();
				dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
				var y = dd.getFullYear();
				var m = dd.getMonth()+1;//获取当前月份的日期
				if(m<10){
					m="0"+m;
				}
				var d = dd.getDate();
				if(d<10){
					d="0"+d;
				}
				var hh = dd.getHours();  //获取当前小时数(0-23)
				if(hh<10){
					hh="0"+hh;
				}
				var min = dd.getMinutes();
				if(min<10){
					min="0"+min;
				}
				var ss = dd.getSeconds();
				if(ss<10){
					ss="0"+ss;
				}
				return y + "-" + m + "-" + d + " " + hh + ":" + min + ":" + ss;
			}
			
			var div1Flag = setInterval(refreshDiv1, 1000*60);
				//var div1Flag = setInterval(refreshDiv2, 1000*5);
				
			
			
			function compareTime(startTime,endTime) {//时间的比较大小2018-04-24 14:59:16
			  var startTimes = startTime.substring(0, 10).split('-');
			  var endTimes = endTime.substring(0, 10).split('-');
			  startTime = startTimes[1] + '-' + startTimes[2] + '-' + startTimes[0] + ' ' + startTime.substring(10, 19);
			  endTime = endTimes[1] + '-' + endTimes[2] + '-' + endTimes[0] + ' ' + endTime.substring(10, 19);
			  console.log(startTime);
			  console.log(endTime);
			  var thisResult = (Date.parse(endTime) - Date.parse(startTime)) / 3600 / 1000;
			  console.log(thisResult);
			  if (thisResult < 0) {
				return  'exception';//结束时间小于开始时间
			  }
			  if (thisResult > 0) {
				return 'success';//结束时间大于开始时间
				//return '';
			  } 
			}
		</script>
	</body>
</html>